package com.zyh.service;

import com.zyh.dao.IUserDao;
import com.zyh.service.impl.UserServiceImpl;
import lombok.Setter;
import org.springframework.beans.factory.FactoryBean;

public class UserServiceFactory3 implements FactoryBean<IUserService> {
    @Setter
    private IUserDao userDao;


    @Override
    public IUserService getObject() throws Exception {
        System.out.println("使用FactoryBean接口创建");
        UserServiceImpl userService = new UserServiceImpl();
        userService.setUserDao(userDao);
        return userService;
    }

    @Override
    public Class<?> getObjectType() {
        return IUserService.class;
    }
}
